# coding: utf-8
from wtforms import StringField, PasswordField, SubmitField
from flask_wtf import FlaskForm
from wtforms.validators import Required,Length,Email,Regexp


class Login_form(FlaskForm):
    name = StringField('用户名',validators=[Required(), Length(0, 64)])
    password = PasswordField('密码', validators=[Required()])
    submit = SubmitField('登陆')


class register_form(Login_form):
    email = StringField('邮箱', validators=[Required(), Length(1, 64), Email()],render_kw={'id':'email'})
    cache = StringField('验证码',validators=[Required(),Length(6)],render_kw={'id':'cache'})
    submit = SubmitField('注册')


class password_form(FlaskForm):
    old_pwd = PasswordField('旧密码', validators=[Required()])
    new_pwd = PasswordField('新密码', validators=[Required(), Length(8,12)])
    re_pwd = PasswordField('重复密码', validators=[Required(), Length(8,12)])
    submit = SubmitField('提交')